<!--
  #%L
  thinkbig-ui-feed-manager
  %%
  Copyright (C) 2017 ThinkBig Analytics
  %%
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at
  
      http://www.apache.org/licenses/LICENSE-2.0
  
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
  #L%
  -->
<card-layout body-css="md-padding">

    <header-section>
        <div layout="row" layout-align="space-between-center" flex>
          <div class="card-title" flex>基本信息</div>
          <h2 class="card-sub-header">{{vm.stepNumber}} of {{vm.totalSteps}}</h2>
        </div>
        <thinkbig-feed-errors-card-header></thinkbig-feed-errors-card-header>
    </header-section>

    <body-section md-content >
<ng-form name="vm.defineFeedGeneralForm">
        <div layout="column">
                <div layout="row" layout-align="space-between start">
                    <md-input-container flex="45" class="condensed">
                        <label>显示名称</label>
                        <input required ng-model="vm.model.feedName" name="feedName" ng-disabled="vm.model.id != null"/>
                        <div ng-messages="vm.defineFeedGeneralForm.feedName.$error"  md-auto-hide="false">
                            <div ng-message="required">需要.</div>
                          <div ng-message="notUnique">具有此名称的管道已存在。</div>
                       </div>
                    </md-input-container>
                    <div flex="10"></div>
                    <md-input-container flex="45" class="condensed">
                        <label>系统名称</label>
                        <input  readonly ng-model="vm.model.systemFeedName"/>
                        <div class="hint">从管道显示名称自动生成</div>
                    </md-input-container>
                </div>
          <div layout="row" layout-align="space-between start">
                    <md-autocomplete flex="45" required ng-disabled="vm.model.id != null"
                                     md-input-name="category"
                            md-selected-item="vm.category"
                            md-search-text-change="vm.categorySearchTextChanged(vm.categorySearchText)"
                            md-search-text="vm.categorySearchText"
                            md-selected-item-change="vm.categorySelectedItemChange(item)"
                            md-items="item in vm.categoriesService.querySearch(vm.categorySearchText)"
                            md-item-text="item.name"
                            md-min-length="0"
                                     md-floating-label="分类"
                            md-menu-class="autocomplete-categories-template">
                        <md-item-template>
                  <span class="item-title" ng-class="item.createFeed ? '' : 'disabled'">
                       <ng-md-icon icon="{{item.icon}}" style="fill:{{item.iconColor}}" ng-if="item.createFeed"></ng-md-icon>
                    <ng-md-icon icon="block" class="disabled" ng-if="!item.createFeed"></ng-md-icon>
                    <span> {{item.name}} </span>
                  </span>
                  <span class="item-metadata">
                    <span class="item-metastat hint"  ng-if="item.createFeed">
                     {{item.description | characters:50}}
                    </span>
                  </span>
                        </md-item-template>
                        <md-not-found>
                            没有分类匹配 "{{vm.categorySearchText}}" were found.
                        </md-not-found>
                      <div ng-messages="vm.defineFeedGeneralForm.category.$error">
                        <div ng-message="required">需要.</div>
                        <div ng-message="accessDenied">您不能在此类别下创建管道。</div>
                      </div>
                  </md-autocomplete>
               </div>

                <md-input-container class="md-block condensed">
                    <label>描述</label>
                    <textarea ng-model="vm.model.description"></textarea>
                </md-input-container>

        </div>

        <thinkbig-step-buttons can-continue="vm.isValid &&  vm.defineFeedGeneralForm.$valid" step-index="{{::vm.stepIndex}}" ></thinkbig-step-buttons>
        </ng-form>
    </body-section>

</card-layout>

